package dw.fastfile.business.controller;

import dw.fastfile.common.dto.CommonResponse;
import dw.fastfile.common.enums.EnumFieldService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @description:
 * @author: wanghao
 * @create: 2022-11-30 17:23
 **/
@RequestMapping("enum")
@RestController
public class EnumCtrl {
    @Resource
    private EnumFieldService enumFieldService;

    @GetMapping("getEnum")
    public CommonResponse<Map<String, Object>> getEnum(@RequestParam String type) {
        Map<String, Object> anEnum = enumFieldService.getEnum(type);
        return CommonResponse.success(anEnum);
    }


    @GetMapping("getName")
    public CommonResponse getName(@RequestParam String type, @RequestParam String code) {
        return CommonResponse.success(enumFieldService.getName(type, code));
    }

}
